<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Creates EvTimer stopped watcher object</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="evtimer.construct.html">« EvTimer::__construct</a></li>
      <li style="float: right;"><a href="evtimer.set.html">EvTimer::set »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.evtimer.html">EvTimer</a></li>
    <li>Creates EvTimer stopped watcher object</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="evtimer.createstopped" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">EvTimer::createStopped</h1>
  <p class="verinfo">(PECL ev &gt;= 0.2.0)</p><p class="refpurpose"><span class="refname">EvTimer::createStopped</span> &mdash; <span class="dc-title">Creates EvTimer stopped watcher object</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-evtimer.createstopped-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="methodname"><strong>EvTimer::createStopped</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    <span class="type">float</span>
     <code class="parameter">$after</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    <span class="type">float</span>
     <code class="parameter">$repeat</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    <span class="type"><a href="language.types.callable.html" class="type callable">callable</a></span>
     <code class="parameter">$callback</code>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    <span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span>
     <code class="parameter">$data</code>
    <span class="initializer"> = <strong><code>null</code></strong></span>
   </span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam">
    <span class="type">int</span>
     <code class="parameter">$priority</code>
    <span class="initializer"> = 0</span>
   </span><br>): <span class="type"><a href="class.evtimer.html" class="type EvTimer">EvTimer</a></span></div>

  <p class="para rdfs-comment">
   Creates EvTimer stopped watcher object. Unlike
   <span class="methodname"><a href="evtimer.construct.html" class="methodname">EvTimer::__construct()</a></span>
   , this method doesn&#039;t start the watcher automatically.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-evtimer.createstopped-parameters">
  <h3 class="title">参数</h3>
  <dl>
   
    <dt>

     <code class="parameter">after</code>
    </dt>

    <dd>

     <p class="para">
      Configures the timer to trigger after
      <code class="parameter">after</code>
      seconds.
     </p>
    </dd>

   
   
    <dt>

     <code class="parameter">repeat</code>
    </dt>

    <dd>

     <p class="para">
      If repeat is
      <strong><code>0.0</code></strong>
      , then it will automatically be stopped once the timeout is reached. If
      it is positive, then the timer will automatically be configured to
      trigger again every repeat seconds later, until stopped manually.
     </p>
    </dd>

   
   
    <dt>

     <code class="parameter">callback</code>
    </dt>

    <dd>

     <p class="para">
      See
      <a href="ev.watcher-callbacks.html" class="link">Watcher callbacks</a>
      .
     </p>
    </dd>

   
   
    <dt>

     <code class="parameter">data</code>
    </dt>

    <dd>

     <p class="para">
      Custom data associated with the watcher.
     </p>
    </dd>

   
   
    <dt>

     <code class="parameter">priority</code>
    </dt>

    <dd>

     <p class="para">
      <a href="class.ev.html#ev.constants.watcher-pri" class="link">Watcher priority</a>
     </p>
    </dd>

   
  </dl>

 </div>

 <div class="refsect1 returnvalues" id="refsect1-evtimer.createstopped-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns EvTimer watcher object on success.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-evtimer.createstopped-examples">
  <h3 class="title">范例</h3>
 <div class="example" id="example-3266">
   <p><strong>示例 #1 Monotor changes of /var/log/messages. Avoid missing updates by means of one second delay</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$timer&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">EvTimer</span><span style="color: #007700">::</span><span style="color: #0000BB">createStopped</span><span style="color: #007700">(</span><span style="color: #0000BB">0.</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1.02</span><span style="color: #007700">,&nbsp;function&nbsp;(</span><span style="color: #0000BB">$w</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$w</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">stop</span><span style="color: #007700">();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$stat&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$w</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;1&nbsp;second&nbsp;after&nbsp;the&nbsp;most&nbsp;recent&nbsp;change&nbsp;of&nbsp;the&nbsp;file<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">printf</span><span style="color: #007700">(</span><span style="color: #DD0000">"Current&nbsp;size:&nbsp;%ld\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$stat</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">attr</span><span style="color: #007700">()[</span><span style="color: #DD0000">'size'</span><span style="color: #007700">]);<br />});<br /><br /></span><span style="color: #0000BB">$stat&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EvStat</span><span style="color: #007700">(</span><span style="color: #DD0000">"/var/log/messages"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0.</span><span style="color: #007700">,&nbsp;function&nbsp;()&nbsp;use&nbsp;(</span><span style="color: #0000BB">$timer</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF8000">//&nbsp;Reset&nbsp;timer&nbsp;watcher<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$timer</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">again</span><span style="color: #007700">();<br />});<br /><br /></span><span style="color: #0000BB">$timer</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">data&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$stat</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">run</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

 <div class="refsect1 seealso" id="refsect1-evtimer.createstopped-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member">
    <span class="methodname"><a href="evtimer.construct.html" class="methodname" rel="rdfs-seeAlso">EvTimer::__construct()</a> - Constructs an EvTimer watcher object</span>
   </li>
   <li class="member">
    <span class="classname"><a href="class.evperiodic.html" class="classname">EvPeriodic</a></span>
   </li>
  </ul>
 </div>

</div></div></div></body></html>